#include "stdafx.h"

#include "..\\common\\CriticalSection.h"

namespace NS_GXX_FILE
{

CMyCriticalSection::CMyCriticalSection ()
{
	::InitializeCriticalSection ( &m_cs );
}
CMyCriticalSection::~CMyCriticalSection()
{
	::DeleteCriticalSection ( &m_cs );
}
void CMyCriticalSection::Lock ()
{
	::EnterCriticalSection( &m_cs );
}
void CMyCriticalSection::Unlock ()
{
	::LeaveCriticalSection( &m_cs );
}

CAutoLock::CAutoLock ( CMyCriticalSection& cs ):m_cs (cs)
{
	cs.Lock ();
}
CAutoLock::~CAutoLock ()
{
	m_cs.Unlock ();
}

}